package cz.proks.bank.service;

import java.util.List;

import javax.jws.WebService;
import javax.xml.ws.WebServiceException;

import cz.cvut.felk.support.aos.sw.clearingcenter.FetchPaymentsFaultException_Exception;
import cz.cvut.felk.support.aos.sw.clearingcenter.GetPaymentsResultFaultException_Exception;
import cz.cvut.felk.support.aos.sw.clearingcenter.Payment;
import cz.cvut.felk.support.aos.sw.clearingcenter.RegisterFaultException_Exception;
import cz.cvut.felk.support.aos.sw.clearingcenter.SendPaymentsFaultException_Exception;
import cz.cvut.felk.support.aos.sw.clearingcenter.SetPaymentsResultFaultException_Exception;
import cz.proks.bank.client.ClearingCenterClient;


@WebService(endpointInterface = "cz.proks.bank.service.ClearingService",
        	serviceName = "ClearingService",
        	portName = "ClearingServicePort",
        	targetNamespace = "http://bank.proks.cz/service/ClearingService/")        
public class ClearingServiceImpl implements ClearingService {	
		
	public void setPaymentsResult(String bankKey,
			List<Payment> paymentsWithResults)
			throws SetPaymentsResultFaultException_Exception {
		getClient().setPaymentsResult(bankKey, paymentsWithResults);
	}

	public List<Long> sendPayments(String bankKey, List<Payment> payments)
			throws SendPaymentsFaultException_Exception {
		return getClient().sendPayments(bankKey, payments);
	}

	public List<Payment> fetchPayments(String bankKey)
			throws FetchPaymentsFaultException_Exception {
		return getClient().fetchPayments(bankKey);
	}

	public List<Payment> getPaymentsResult(String bankKey, List<Long> paymentIds)
			throws GetPaymentsResultFaultException_Exception {
		return getClient().getPaymentsResult(bankKey, paymentIds);
	}	

	
	public String register(String bankCode)
			throws RegisterFaultException_Exception {
		return getClient().register(bankCode);
	}

	private ClearingCenterClient getClient() throws WebServiceException {
		return new ClearingCenterClient();		
	}
}
